﻿@using Models;
@model scorelog
@{
    ViewBag.Title = "打分";
    Layout = "~/Areas/Mobile/Views/Shared/_Layout.cshtml";
}
<div class="header">
    <img src="~/Areas/Mobile/HTML/images/banner-1.png" />
</div>
<div class="player-info">
    <p>请为 <span class="player-name">@(ViewBag.PlayerSort)号</span> 选手打分</p>
    <img class="doctor-img" src="~/Areas/Mobile/HTML/images/doctor.png" />
</div>
<form class="player-form" id="player-form">
    @Html.HiddenFor(o => o.playerid)
    <input type="number" name="Score" id="Score" value="" placeholder="输入分数" />
    <p style="color:green;">温馨提示，请输入1至10之间的整数</p>
    <button class="btn-block" type="button" onclick="SaveScore(this)">提交</button>
</form>
<script>
    var lock = false;
    function SaveScore(target) {
        if (lock) {
            return false;
        }
        else {
            lock = true;
            Loading();
            var score = parseInt($("#Score").val());
            if (isNaN(score) || score < 1 || score > 10) {
                mui.alert("请输入 1-10 之间的分数！");
                lock = false;
                CloseLoading();
                return false;
            }
            var data = $("#player-form").serialize();
            $.post("/mobile/survey/mark", data, function (result) {
                lock = false;
                CloseLoading();
                if (result.status) {
                    mui.alert(result.data, function () {
                        window.location.href = "/mobile/survey/notopen?msg=感谢您的评分！";
                    });
                } else {
                    mui.alert(result.errmsg);
                }
            });
        }
    }
</script>